﻿<!DOCTYPE>
<html>
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=EDGE;IE=11;IE=8,chrome=1" />
    <title>热表无订单批次维护页面</title>
    <link href="/InSiteWebApplication/Content/Easyui/themes/metro/easyui.css" rel="stylesheet" />
    <link href="/InSiteWebApplication/Content/Easyui/custom-easyui.css" rel="stylesheet" />
    <link href="/InSiteWebApplication/Content/Easyui/themes/icon.css" rel="stylesheet" />
</head>
<body>
    <div id="mainSec">
        <div class="panelSection">
            <div class="easyui-panel " title="查询区域" style="padding: 3px;" data-options="closable:false,collapsible:true,minimizable:false,maximizable:false">
                <form id="queryForm">
                <div style="margin: 3px 0px 3px 3px">
                    <div style="float: left;">
                        <div class="divLabel" style="margin-bottom: 5px">
                            采购订单号：</div>
                        <input id="txtOrderName" name="orderName" class="easyui-textbox" style="width: 120px;
                            height: 20px" />
                    </div>
                    <div style="float: left; margin-left: 10px">
                        <div class="divLabel" style="margin-bottom: 5px">
                            件号（物料号）：</div>
                        <input id="txtProductName" name="productName" class="easyui-textbox" style="width: 120px;
                            height: 20px" />
                    </div>
                    <div style="float: left; margin-left: 10px">
                        <div class="divLabel" style="margin-bottom: 5px">
                            委托单位：</div>
                        <input id="txtEntrustUnit" name="entrustUnit" class="easyui-textbox" style="width: 120px;
                            height: 20px" />
                    </div>
                    <div style="float: left; margin-left: 10px">
                        <div class="divLabel" style="margin-bottom: 5px">
                            委托批次：</div>
                        <input id="txtEntrustContainer" name="entrustContainer" class="easyui-textbox" style="width: 120px;
                            height: 20px" />
                    </div>
                    <div style="float: left; margin-left: 10px;">
                        <div class="divLabel" style="margin-bottom: 5px">
                            状态：</div>
                        <select style='width: 100px; height: 20px' id='selStatus' name="status" data-options="value:0,editable:false,panelHeight:'auto'"
                            class='easyui-combobox'>
                            <option value="0">未接收</option>
                            <option value="1">已接收</option>
                            <option value="2">已开卡</option>
                            <option value="3">已完工</option>
                        </select>
                    </div>
                    <div style="float: left; margin-left: 20px">
                        <button id="btnSearch" type="button" class="easyui-linkbutton" data-options="" style="margin-top: 16px;
                            width: 100px">
                            查询</button>
                        <button id="btnReset" type="button" class="easyui-linkbutton" data-options="" style="margin-top: 16px;
                            margin-left: 5px; width: 60px">
                            重置</button>
                    </div>
                </div>
                </form>
                <div style="clear: both">
                </div>
            </div>
        </div>
        <div class="panelSection">
            <div class="easyui-panel " title="结果区域" style="padding: 3px;" data-options="closable:false,collapsible:true,minimizable:false,maximizable:false">
                <div style="margin: 3px 0px 3px 3px;">
                    <table id="gdOrderInfo" class="easyui-datagrid" style="width: 100%; height: 500px"
                        data-options="rownumbers:true">
                    </table>
                    <div id="pp" style="float: right" class="easyui-pagination" data-options="   
                 layout:['first','prev','next','last','manual','info'],              
                    total: 0,
                    showPageList: false,
                    showPageInfo: false,
                    showRefresh: false,
                    afterPageText:'共&nbsp{pages}&nbsp页',
                    buttons:[{
                            iconCls:'',
                            text:'Go',
                            id:'pageGo'
                    }]  
                ">
                    </div>
                </div>
            </div>
        </div>
        <div class="panelSection">
            <div class="easyui-panel " title="按钮区域" style="padding: 3px;" data-options="closable:false,collapsible:true,minimizable:false,maximizable:false">
                <div style="margin: 3px 0px 3px 3px">
                    <button id="btnReceive" class="easyui-linkbutton" type="button" style="width: 120px;
                        height: 24px;">
                        接收</button>
                    <button id="btnStart" class="easyui-linkbutton" type="button" style="width: 120px;
                        height: 24px;">
                        开卡</button>
                    <button id="btnComplete" class="easyui-linkbutton" type="button" style="width: 120px;
                        height: 24px;">
                        完工确认</button>
                    <button id="btnScanAdd" class="easyui-linkbutton" type="button" style="width: 150px;
                        height: 24px;">
                        扫描添加</button>
                    <button id="btnEditPlanDate" class="easyui-linkbutton" type="button" style="width: 150px;
                        height: 24px;">
                        维护计划日期</button>
                </div>
            </div>
        </div>
    </div>
    <div id="dgScanForm" style="padding: 20px 0 0 0; display: none; width: 1100px; height: 650px"
        data-options="title:'自动开卡规则编辑'">
        <div id="scanSec" style="width: 98%">
            <div style="opacity: 0;">
                <input type="text" id="scanData" style="width: 100%; height: 1px; border: 0px; outline: 0px;" />
            </div>
            <div style="margin-top: 10px;">
                <table id="dgScanInfo" class="easyui-datagrid" style="width: 100%; height: 400px"
                    data-options="rownumbers:true">
                </table>
            </div>
        </div>
        <div style="margin-top: 40px; text-align: right; padding-right: 10px; float: right">
            <a href="javascript:void(0);" id="btnScanSave" class="easyui-linkbutton not-custom l-btn2 "
                data-options="" style="margin-left: 0px; height: 30px; width: 100px">保存</a>
            <a href="javascript:void(0);" id="btnScanCancel" class="easyui-linkbutton not-custom l-btn2 "
                data-options="" style="margin-left: 10px; height: 30px; width: 60px">取消</a>
        </div>
        <div id="showResSec" style="margin-top: 10px; height: 100px">
            <div style="float: left;">
                <div class="divLabel" style="margin-bottom: 5px; font-size: 16px">
                    扫码数据：</div>
                <div id="encryptionData" style="font-size: 10px; word-wrap: break-word; white-space: normal;
                    width: 1050px">
                </div>
            </div>
            <div style="float: left;">
                <div class="divLabel" style="margin-bottom: 5px; font-size: 16px">
                    解码后行数据：</div>
                <div id="decryptionData" style="font-size: 10px; word-wrap: break-word; white-space: normal;
                    width: 1050px">
                </div>
            </div>
        </div>
    </div>
    <div id="dg">
    </div>
    <div id="dgPlan" title="编辑计划时间" style="width: 400px; height: 320px; display: none"
        data-options="iconCls:'icon-save',resizable:true">
        <div style="padding: 50px 50px 50px 50px">
            <div style="width: 100%;">
                <label for="Checkcycle" style="font-size: 16px">
                    计划开始日期:</label>
                <input type="text" class="easyui-datebox" id="planStartDate" name="planStartDate"
                    style="width: 180px" data-options='editable:false' />
            </div>
            <div style="width: 100%; margin-top: 30px">
                <label for="Checkcycle" style="font-size: 16px">
                    计划结束日期:</label>
                <input type="text" class="easyui-datebox" id="planEndDate" name="planEndDate"
                    style="width: 180px" data-options='editable:false' />
            </div>
            <div style="width: 100%; margin-top: 30px">
                <button class="easyui-linkbutton" type="button" style="width: 150px; height: 26px"
                    id="btnSavePlanDate">
                    保存</button>
                <a href="#" class="easyui-linkbutton" style="width: 100px; height: 26px; margin-left: 30px" id="btnClosePlan">
                    关闭</a>
            </div>
        </div>
    </div>
</body>
</html>
<script src="/InSiteWebApplication/Scripts/CustomPageJs/ReferenceJsLib.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/jquery.min.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/jquery.easyui.min.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/easyui-lang-zh_CN.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Scripts/CustomPageJs/CustomCommon.js" type="text/javascript"></script>
<script type="text/javascript">
    /*
    创建人：zhangrj
    日期：2024-12-04
    描述：热表采购订单扫描维护页面js
    */
    var page = {
        pageTotal: 0,
        pageSize: 20,
        pageNumber: 1,
        rootPath: getRootPath(), //网站根路径
        ajaxUrl: getRootPath() + "/Ashx/ReBiaoConainer/RbOrderContainerStartHandler.ashx",
        //初始化页面
        init: function () {
            page.bind();
            scanFormPage.bind();
            planDatePage.bind();
            customizedEasyuiPagination('pp'); //定制化分页
            $("#btnComplete").hide();
            $("#btnStart").hide();
        },
        //页面事件绑定
        bind: function () {
            //列表加载
            $("#gdOrderInfo").datagrid({
                onLoadSuccess: function (data) {
                    $('#pp').pagination('refresh', {	// 改变选项，并刷新分页栏信息
                        total: page.pageTotal,
                        pageSize: page.pageSize,
                        pageNumber: page.pageNumber
                    });
                    customizedEasyuiPagination('pp'); //定制化分页
                },
                columns: [[
                 { field: 'ck', title: '选择', checkbox: true },
                 { field: 'OUTBOUNDORDERNUM', title: '出库单号', width: 120 },
                 { field: 'PURCHASEORDERNUM', title: '采购订单号', width: 120 },
                 { field: 'MATERIALNUM', title: '物料编号', width: 100 },
                 { field: 'MATERIALNAME', title: '物料名称', width: 120 },
                 { field: 'QTY', title: '数量', width: 60 },
                 { field: 'UNITNAME', title: '单位', width: 80 },
                 { field: 'SPECNO', title: '工序号', width: 80 },
                 { field: 'SPECNAME', title: '工序', width: 100 },
                 { field: 'SUPPLIERNAME', title: '供应商名称', width: 120 },
                 { field: 'SUPPLIERCONTAINERNAME', title: '供应商批次', width: 100 },
                 { field: 'PLANSTARTDATE', title: '计划开始日期', width: 100, editor: { type: 'datebox' }, formatter: function (value, row, index) {
                     if (!isNullOrWhiteSpaceStr(value)) {
                         return dayjs(value).format('YYYY-MM-DD');
                     }
                 }
                 },
                 { field: 'PLANENDDATE', title: '计划结束日期', width: 100, editor: { type: 'datebox' }, formatter: function (value, row, index) {
                     if (!isNullOrWhiteSpaceStr(value)) {
                         return dayjs(value).format('YYYY-MM-DD');
                     }
                 }
                 },
                 { field: 'MFGORDERNAME', title: 'MES订单', width: 100 },
                 { field: 'CONTAINERNAME', title: '批次名', width: 180 },
                 { field: 'RECEIVENAME', title: '任务接收人', width: 80 },
                 { field: 'RECEIVEDATE', title: '任务接收日期', width: 120,
                     formatter: function (value, row, index) {
                         if (!isNullOrWhiteSpaceStr(value)) {
                             return dayjs(value).format('YYYY-MM-DD');
                         }
                     }
                 },
                 { field: 'COMPLETENAME', title: '完工确认人', width: 80 },
                 { field: 'COMPLETEDATE', title: '完工确认日期', width: 120,
                     formatter: function (value, row, index) {
                         if (!isNullOrWhiteSpaceStr(value)) {
                             return dayjs(value).format('YYYY-MM-DD');
                         }
                     }
                 }
                ]]
            });
            //查询按钮
            $('#btnSearch').on("click", function () {
                page.clearPage(false, true);
                page.pageNumber = 1;
                page.search();
            });
            //分页事件
            $('#pp').pagination({
                onSelectPage: function (pageNumber, pageSize) {
                    customizedEasyuiPagination('pp'); //定制化分页
                    page.pageSize = pageSize; page.pageNumber = pageNumber;
                    page.search();
                }
            });
            //绑定分页go按钮
            $('#pageGo').on("click", function () {
                var pageNumber = $(this).parents('tr').find('.pagination-num').val();
                page.pageNumber = pageNumber;
                page.search();
            });
            //清除按钮
            $('#btnReset').on("click", function () {
                page.clearPage(true, true);
            });
            //接收（计划接收）
            $('#btnReceive').on("click", function () {
                page.receive();
            });
            //开卡
            $('#btnStart').on("click", function () {
                page.start();
            });
            //完成（批次完成）
            $('#btnComplete').on("click", function () {
                page.complete();
            });
            //批量维护计划时间
            $('#btnEditPlanDate').on("click", function () {
                page.openPlanDateForm();
            });
            //状态选择
            $("#selStatus").combobox({
                onChange: function (value) {
                    switch (value) {
                        case "0":
                            $("#btnReceive").show();
                            $("#btnStart").hide();
                            $("#btnComplete").hide();
                            $("#btnEditPlanDate").show();
                            break;
                        case "1":
                            $("#btnReceive").hide();
                            $("#btnStart").show();
                            $("#btnComplete").hide();
                            $("#btnEditPlanDate").show();
                            break;
                        case "2":
                            $("#btnReceive").hide();
                            $("#btnStart").hide();
                            $("#btnComplete").show();
                            $("#btnEditPlanDate").hide();
                            break;
                        default:
                            $("#btnReceive").hide();
                            $("#btnStart").hide();
                            $("#btnComplete").hide();
                            $("#btnEditPlanDate").hide();
                            break;
                    }
                    page.clearPage(false, true);
                }
            });
            //扫码添加数据
            $('#btnScanAdd').on("click", function () {
                page.disableBtn(); //禁用主页面按钮
                $('#dgScanForm').dialog({
                    onClose: function () {
                        page.enableBtn();
                    }
                });
                scanFormPage.init();
            });
        },
        //查询
        search: function () {
            var params = {
                pageSize: page.pageSize,
                pageIndex: page.pageNumber
            };
            var queryFormData = $("#queryForm").serializeArray();
            $.each(queryFormData, function () {
                params[this.name] = this.value;
            });
            page.post(page.ajaxUrl, { action: "GetScanOrderShipList", params: JSON.stringify(params) }, true, function (res) {
                if (!res.Result) {
                    displayMessage(res.Message, res.Result);
                    return;
                }
                page.pageTotal = res.RowCount;
                $("#gdOrderInfo").datagrid('loadData', { total: res.RowCount, rows: res.DBTable });
            });
        },
        //接收（计划接收）
        receive: function () {
            var selected = $("#gdOrderInfo").datagrid("getChecked");
            if (selected.length === 0) {
                displayMessage("请选择数据", false);
                return false;
            }
            page.disableBtn();
            page.post(page.ajaxUrl, { action: "PurchaseOrderShipDataReceive", params: JSON.stringify(selected) }, true, function (res) {
                page.enableBtn();
                if (!res.Result) {
                    displayMessage(res.Message, res.Result);
                    return;
                }
                page.search();
            });
        },
        //开卡
        start: function () {
            var selected = $("#gdOrderInfo").datagrid("getChecked");
            if (selected.length === 0) {
                displayMessage("请选择数据", false);
                return false;
            }
            if (selected.length > 1) {
                displayMessage("请选择一条数据进行开卡", false);
                return false;
            }
            page.disableBtn();
            var datas = {
                action: "IsValidAndCreateMfgOrder",
                rbOrderShipManageInfoID: selected[0].RBORDERSHIPMANAGEINFOID
            }
            page.post(page.ajaxUrl, datas, true, function (res) {
                if (!res.Result) {
                    page.enableBtn();
                    displayMessage(res.Message, res.Result);
                    return;
                }
                var paras = $.param({ v: new Date().getTime(), orderName: res.ReturnData.Name, productID: res.ReturnData.ProductID, orderShipID: selected[0].RBORDERSHIPMANAGEINFOID }); //拼接url参数
                var url = "/InSiteWebApplication/forms/Custom/ReBiao/RbOrderContainerStartPage.html?" + paras;
                $('#dg').dialog({
                    title: '热表订单流水卡创建',
                    width: 1050,
                    height: 500,
                    content: "<iframe scrolling='auto' frameborder='0' src='" + url + "' style='width:100%; height:100%; display:block;'></iframe>",
                    onClose: function () {
                        page.enableBtn();
                        page.clearPage(false, true, true);
                        page.search();
                    }
                });
            });
        },
        //完成
        complete: function () {
            var selected = $("#gdOrderInfo").datagrid("getChecked");
            if (selected.length === 0) {
                displayMessage("请选择数据", false);
                return false;
            }
            var container = selected.map(function (item) {
                return {
                    containerID: item.CONTAINERID,
                    containerName: item.CONTAINERNAME
                }
            });
            var datas = {
                action: "SaveRbOrderContainerReceive",
                paramDt: JSON.stringify(container),
                type: 2
            }
            page.post(page.ajaxUrl, datas, true, function (res) {
                if (res.Result) {
                    page.search();
                }
                displayMessage(res.Message, res.Result);
            });
        },
        //打开维护计划日期弹窗
        openPlanDateForm: function () {
            var selectData = $('#gdOrderInfo').datagrid('getChecked');
            if (selectData.length === 0) {
                displayMessage("请选择数据", false);
                return;
            }
            var datas = selectData.map(function (item) {
                return {
                    rbordershipmanageinfoid: item.RBORDERSHIPMANAGEINFOID,
                    planstartdate: item.PLANSTARTDATE,
                    planenddate: item.PLANENDDATE
                }
            });
            planDatePage.init(datas);
        },
        //禁用页面按钮
        disableBtn: function () {
            $("#mainSec").find(".easyui-linkbutton").each(function () {
                $(this).linkbutton('disable');
            });
        },
        //启用页面按钮
        enableBtn: function () {
            $("#mainSec").find(".easyui-linkbutton").each(function () {
                $(this).linkbutton('enable');
            });
        },
        clearPage: function (query, list) {
            if (query) {
                $("#txtOrderName").textbox("setValue", "");
                $("#txtProductName").textbox("setValue", "");
                $("#txtEntrustUnit").textbox("setValue", "");
                $("#txtEntrustContainer").textbox("setValue", "");
                page.pageNumber = 1; page.pagetotal = 0
                $('#pp').pagination('refresh', {
                    total: page.pageTotal,
                    pageSize: page.pageSize,
                    pageNumber: page.pageNumber
                });
            }
            if (list) {
                clearEasyuiDataGrid("gdOrderInfo"); //清空列表
            }
        },
        //post数据（路径，参数，是否异步，成功返回方法）
        post: function (url, param, async, callback) {
            $.ajax({
                type: "Post",
                url: url,
                data: param,
                cashe: false,
                async: async,
                dataType: "json",
                beforeSend: function () {
                    $.messager.progress({ text: '', msg: '处理中...' });
                },
                success: function (data) {
                    $.messager.progress('close');
                    callback(data);
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    $.messager.progress('close');
                    displayMessage(XMLHttpRequest.responseText, false);
                    $("body").find(".easyui-linkbutton").each(function () {
                        $(this).linkbutton('enable');
                    });
                }
            });
        }
    };
    //扫码添加对象
    var scanFormPage = {
        currNum: 0,
        init: function () {
            scanFormPage.initPage(); //初始化页面数据
        },
        //初始化页面
        initPage: function () {
            clearEasyuiDataGrid("dgScanInfo"); //清空列表
            scanFormPage.currNum = 0;
            $("#showResSec").hide();
            $("#scanData").val("");
            $("#scanData").focus();
        },
        //绑定页面事件
        bind: function () {
            //列表加载
            $("#dgScanInfo").datagrid({
                columns: [[
                 { field: 'ck', title: '选择', checkbox: true },
                 { field: 'outboundordernum', title: '出库单号', width: 120 },
                 { field: 'purchaseordernum', title: '采购订单号', width: 120 },
                 { field: 'materialnum', title: '物料编号', width: 100 },
                 { field: 'materialname', title: '物料名称', width: 120 },
                 { field: 'qty', title: '在制数', width: 60 },
                 { field: 'unitname', title: '单位', width: 80 },
                 { field: 'specno', title: '工序号', width: 80 },
                 { field: 'specname', title: '工序', width: 100 },
                 { field: 'suppliername', title: '供应商名称', width: 120 },
                 { field: 'suppliercontainername', title: '供应商批次', width: 100 },
                 { field: 'planstartdate', title: '计划开始日期', width: 100, formatter: function (value, row, index) {
                     if (!isNullOrWhiteSpaceStr(value)) {
                         return dayjs(value).format('YYYY-MM-DD');
                     }
                 }
                 },
                 { field: 'planenddate', title: '计划结束日期', width: 100, formatter: function (value, row, index) {
                     if (!isNullOrWhiteSpaceStr(value)) {
                         return dayjs(value).format('YYYY-MM-DD');
                     }
                 }
                 }
                ]]
            });
            //扫码按下
            $("#scanData").on("keydown", function (e) {
                if (e.which === 13) {
                    var scanData = $("#scanData").val();
                    if (scanData === "" || scanData === null) {
                        $.messager.alert('错误', '请扫描数据', 'error', function () {
                            $("#scanData").focus();
                        });
                        return;
                    }
                    var formData = {
                        action: "GetParsedScanData",
                        scanData: scanData,
                        currcodenum: scanFormPage.currNum,
                        outboundordernum: ""
                    };
                    var orderRow = $('#dgScanInfo').datagrid('getRows');
                    if (orderRow.length !== 0) {
                        formData.outboundordernum = orderRow[0]["outboundordernum"];
                    }
                    page.post(page.ajaxUrl, formData, true, function (res) {
                        if (res.Result) {
                            scanFormPage.currNum = scanFormPage.currNum + 1; //记录扫码的次数
                            for (var i = 0; i < res.ReturnData.dtOrder.length; i++) {
                                $('#dgScanInfo').datagrid('appendRow', res.ReturnData.dtOrder[i]);
                            }
                            displayMessage(res.Message, res.Result);
                            $("#scanData").val(""); //将扫码框清空
                            $("#scanData").focus();
                        }
                        else {//如果报错，则将扫码信息及解密后的数据显示出来
                            $("#showResSec").show();
                            $("#encryptionData").text(scanData);
                            if (res.ReturnData !== null) {
                                $("#decryptionData").text(res.ReturnData.decryptionStr);
                            }
                            $.messager.alert('错误', res.Message, 'info', function () {
                                $("#scanData").val(""); //将扫码框清空
                                $("#scanData").focus();
                            });
                        }
                    });
                }
            });
            //扫码区域点击都要聚焦
            $("#scanSec").on("click", function () {
                $("#scanData").focus();
            });
            //规则弹窗保存
            $('#btnScanSave').on("click", function () {
                scanFormPage.saveData();
            });
            //规则弹窗取消
            $('#btnScanCancel').on("click", function () {
                $('#dgScanForm').dialog("close");
            });
        },
        //保存数据
        saveData: function () {
            var rows = $('#dgScanInfo').datagrid('getRows');
            if (rows.length === 0) {
                displayMessage("请扫描数据", false);
                return;
            }

            page.post(page.ajaxUrl, { action: "SavePurchaseOrderShipData", params: JSON.stringify(rows) }, true, function (res) {
                if (res.Result) {
                    $('#dgScanForm').dialog("close");
                    page.search();
                }
                displayMessage(res.Message, res.Result);
            });
        }
    };

    /*---------手动指定开始日期弹窗页面对象-------------*/
    var planDatePage = {
        selectedDatas: null, //所选批次信息
        init: function (rowDatas) {
            planDatePage.clearPage();
            page.disableBtn();
            planDatePage.selectedDatas = rowDatas;
            planDatePage.initData();
            $("#dgPlan").dialog({
                onClose: function () { //弹窗关闭事件
                    page.enableBtn();
                }
            });
        },
        //初始化页面数据
        initData: function () {
            if (planDatePage.selectedDatas.length === 1) {
                if (planDatePage.selectedDatas[0].planstartdate !== null) {
                    $("#planStartDate").datebox("setValue", planDatePage.selectedDatas[0].planstartdate);
                    $("#planEndDate").datebox("setValue", planDatePage.selectedDatas[0].planenddate);
                }
            }
        },
        bind: function () {
            $("#btnSavePlanDate").on('click', function () {
                planDatePage.savePlanDate();
            });
            $("#btnClosePlan").on('click', function () {
                $("#dgPlan").dialog('close');
            });
        },
        //保存日期
        savePlanDate: function () {
            if (planDatePage.selectedDatas === null) {
                displayMessage("未选择批次", false);
                return;
            }
            planDatePage.disableBtn();
            var formData = {
                action: "SaveOrderShipManagePlanDate",
                shipDatas: JSON.stringify(planDatePage.selectedDatas),
                planStartDate: $("#planStartDate").datebox("getValue"),
                planEndDate: $("#planEndDate").datebox("getValue")
            };
            page.post(page.ajaxUrl, formData, true, function (res) {
                if (res.Result) {
                    $("#dgPlan").dialog("close");
                    page.search();
                }
                planDatePage.enableBtn();
                displayMessage(res.Message, res.Result);
            });
        },
        //清除页面数据
        clearPage: function () {
            planDatePage.selectedDatas = null;
            $("#planStartDate").datebox("clear");
            $("#planEndDate").datebox("clear");
        },
        //禁用按钮
        disableBtn: function () {
            $("#dgPlan").find(".easyui-linkbutton").each(function () {
                $(this).linkbutton('disable');
            });
        },
        //启用按钮
        enableBtn: function () {
            $("#dgPlan").find(".easyui-linkbutton").each(function () {
                $(this).linkbutton('enable');
            });
        }
    };

    //页面加载完成后
    $(function () {
        page.init();
    });
</script>
